
function ProbabilitiesManager:onPropertyCollapsed(entity, propertyName)

	--print("Entity " .. entity.type .. " " .. entity.name .. " collapsed " .. propertyName)
	
	if 
		(entity.type == "Key") and
		(propertyName == "CurrentContainer")
	then
		self:keyLocationCollapsed(entity)
	end
end

---

function ProbabilitiesManager:keyLocationCollapsed(key)

	local relatedDoor = gField.entityTypes.Door[key.name]
	
	if relatedDoor:hasUndeterminedSate() then
	
		relatedDoor.EnablingSteps[Door.LockedStep] = relatedDoor.EnablingSteps[Door.LockedStep] * 10
		
		gLogger:log("Increase by 10 the probability of Door " .. relatedDoor.name .. " to be collapsed locked because is key just collapsed", true)
	end
end